package p270jp.pxv.android.viewholder;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import java.util.Objects;
import p045be.IllustSeriesRecyclerAdapter;
import p270jp.pxv.android.R;
import p270jp.pxv.android.activity.IllustSeriesListActivity;
import p270jp.pxv.android.model.PixivIllustSeriesDetail;
import p270jp.pxv.android.model.PixivProfile;
import p307l9.EdgeTreatment;
import p325m0.MutabilityOwnership;
import p370ni.InfoType;
import p374nm.UserProfileContentsView;
import p374nm.View$OnClickListenerC5389d;
import p451qm.GridItemDecoration;
import p677zi.PixivImageLoader;

/* renamed from: jp.pxv.android.viewholder.UserProfileIllustSeriesViewHolder */
/* loaded from: classes2.dex */
public class UserProfileIllustSeriesViewHolder extends RecyclerView.AbstractC0819y {
    private static final int COLUMN_NUM;
    private static final int ROW_NUM;
    private IllustSeriesRecyclerAdapter adapter;
    private final UserProfileContentsView userProfileContentsView;

    private UserProfileIllustSeriesViewHolder(UserProfileContentsView t0Var, PixivImageLoader aVar) {
        super(t0Var);
        this.userProfileContentsView = t0Var;
        this.adapter = new IllustSeriesRecyclerAdapter(aVar);
        this.itemView.getContext();
        t0Var.m3326a(new LinearLayoutManager(0, false), new GridItemDecoration(this.itemView.getResources().getDimensionPixelSize(R.dimen.manga_item_divider_size), 10, 0), this.adapter);
    }

    /* renamed from: a */
    public static /* synthetic */ void m4388a(UserProfileIllustSeriesViewHolder userProfileIllustSeriesViewHolder, long j, View view) {
        userProfileIllustSeriesViewHolder.lambda$onBindViewHolder$0(j, view);
    }

    public static UserProfileIllustSeriesViewHolder createViewHolderByParentView(ViewGroup viewGroup, PixivImageLoader aVar) {
        return new UserProfileIllustSeriesViewHolder(new UserProfileContentsView(viewGroup.getContext()), aVar);
    }

    public void lambda$onBindViewHolder$0(long j, View view) {
        Context context = this.itemView.getContext();
        Context context2 = this.itemView.getContext();
        MutabilityOwnership.m3745m(context2, "context");
        Intent intent = new Intent(context2, IllustSeriesListActivity.class);
        intent.putExtra("USER_ID", j);
        context.startActivity(intent);
    }

    public void onBindViewHolder(long j, PixivProfile pixivProfile, List<PixivIllustSeriesDetail> list) {
        EdgeTreatment.m3909i(list);
        this.userProfileContentsView.setTitleText(this.itemView.getContext().getString(R.string.illust_series_title));
        UserProfileContentsView t0Var = this.userProfileContentsView;
        t0Var.setReadMoreText(String.valueOf(pixivProfile.totalIllustSeries) + this.itemView.getContext().getString(R.string.series_count_suffix));
        this.userProfileContentsView.setReadMoreTextClickListener(new View$OnClickListenerC5389d(this, j, 1));
        IllustSeriesRecyclerAdapter c0Var = this.adapter;
        List<PixivIllustSeriesDetail> subList = list.subList(0, Math.min(10, list.size()));
        Objects.requireNonNull(c0Var);
        EdgeTreatment.m3909i(subList);
        c0Var.f4612d = subList;
        this.adapter.f3606a.m10780b();
        UserProfileContentsView t0Var2 = this.userProfileContentsView;
        Objects.requireNonNull(t0Var2);
        if (list.isEmpty()) {
            t0Var2.f24092a.f21700q.setVisibility(0);
            t0Var2.f24092a.f21700q.m4595d(InfoType.LOADING, null);
            t0Var2.f24092a.f21702s.setVisibility(0);
            return;
        }
        t0Var2.f24092a.f21700q.setVisibility(8);
        t0Var2.f24092a.f21702s.setVisibility(0);
    }
}
